import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    component: () => import('@/views/home.vue'),
    name: 'Root',
    meta: {
      title: '首页',
    },
    redirect: '/index',
    children: [
      {
        path: '/index',
        name: 'Index',
        component: () => import('@/views/index.vue'),
      },
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login.vue')
  },
  {
    path: "/redirect/:path(.*)",
    component: () => import("@/views/common/redirect.vue")
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: () => import('@/views/common/404.vue')
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes,
})

export default router